#!/bin/sh

d=`dirname $0`
if which realpath >/dev/null 2>&1; then
    EBBS_ROOT=`realpath $d`
else
    EBBS_ROOT=`pwd`/$d
fi

# The dtl_server:lookup/1 usage in %EBBS_ROOT%htdocs/ and
# conf/ebbs.config require this.
echo Change to directory $EBBS_ROOT
cd "$EBBS_ROOT"

if which cygpath >/dev/null 2>&1; then
    EBBS_ROOT=`cygpath -m "$EBBS_ROOT"`
fi

export ERL_LIBS="$EBBS_ROOT/lib"

erl -boot start_sasl -config "$EBBS_ROOT/conf/ebbs" \
    -mnesia dir "\"$EBBS_ROOT/database\""           \
    -s ebbs start

